package cn.edu.seig.textbook.service.impl;

import cn.edu.seig.textbook.domain.pojo.Teachers;
import cn.edu.seig.textbook.mapper.TeachersMapper;
import cn.edu.seig.textbook.service.ITeachersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author day
 * @since 2024-11-07
 */
@Service
public class TeachersServiceImpl extends ServiceImpl<TeachersMapper, Teachers> implements ITeachersService {

    @Autowired
    private TeachersMapper teachersMapper;
    @Override
    public List<Teachers> findAll(){
        return teachersMapper.selectList(null);
    }

    @Override
    public Teachers findById(int id) {
        return teachersMapper.selectById(id);
    }

    @Override
    public boolean add(Teachers teachers) {
        return teachersMapper.insertOrUpdate(teachers);
    }

    @Override
    public void update(Teachers teachers) {
        teachersMapper.updateById(teachers);
    }

    @Override
    public void delete(int id) {
        teachersMapper.deleteById(id);
    }

}
